import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { QuestionModule } from './question/question.module';
import { MongooseModule } from '@nestjs/mongoose'; // 连接MongoDB数据库
import { ConfigModule } from '@nestjs/config';
import { UserModule } from './user/user.module';
import { AuthService } from './auth/auth.service';
import { AuthController } from './auth/auth.controller';
import { AuthModule } from './auth/auth.module';
import { AnswerModule } from './answer/answer.module';
import * as dotenv from 'dotenv';
dotenv.config();

@Module({
    imports: [
        // MongooseModule.forRoot('mongodb://127.0.0.1:27017/tyn_nestdb'),
        MongooseModule.forRoot(
            `mongodb://${process.env.MONGO_HOST}:${process.env.MONGO_PORT}/${process.env.MONGO_DATABASE}`
        ),
        ConfigModule.forRoot(),
        QuestionModule,
        UserModule,
        AuthModule,
        AnswerModule,
    ],
    controllers: [AppController, AuthController],
    providers: [AppService, AuthService],
})
export class AppModule {}
